package br.com.management.mentor.view.core.menu.handlers;

import org.springframework.beans.factory.annotation.Autowired;

import br.com.management.mentor.model.entities.view.Menu;
import br.com.management.mentor.view.ProductView;
import br.com.management.mentor.view.core.ViewManager;
import br.com.management.mentor.view.core.menu.MenuHandler;

public class ProductMenuHandler implements MenuHandler {

	@Autowired
	private ViewManager manager;
	
	@Override
	public boolean canHandle( Menu menu ) {
		return menu.getKey().equals( "menu.products" );
	}

	@Override
	public void handle( Menu menu ) {
		new ProductView( manager.getViewsContainer() );
		manager.getViewsContainer().update();
	}

}